package com.hutou.chuangke.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hutou.chuangke.R;
import com.hutou.chuangke.uitl.CommonUtils;
import com.hutou.chuangke.uitl.SharedPreferencesUtil;

/**
 * Created by o on 2017/4/7.
 */
    public class AccountSafetyActivity extends BaseActivity implements View.OnClickListener {
    Toolbar toolbar;
    private RelativeLayout modify_password_layout, phone_layout,
            weichat_layout, qq_layout, micro_blog_layout;
    private TextView weichat_tv, phone_tv, qq_tv, micro_blog_tv;
    private Context mContext;
    private SharedPreferencesUtil sharedPreferencesUtil;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_account_safety);
        mContext = AccountSafetyActivity.this;
        initView();

    }

    private void initView() {
        sharedPreferencesUtil = new SharedPreferencesUtil();
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setPadding(0, CommonUtils.getStatusHeight(AccountSafetyActivity.this), 0, 0);
        setSupportActionBar(toolbar);
        final ActionBar ab = getSupportActionBar();
        ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
        ab.setDisplayHomeAsUpEnabled(true);
        ab.setTitle("");
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        showQuickControl(false);
        modify_password_layout = (RelativeLayout) findViewById(R.id.modify_password_layout);
        modify_password_layout.setOnClickListener(this);
        phone_layout = (RelativeLayout) findViewById(R.id.phone_layout);
        weichat_layout = (RelativeLayout) findViewById(R.id.weichat_layout);
        qq_layout = (RelativeLayout) findViewById(R.id.qq_layout);
        micro_blog_layout = (RelativeLayout) findViewById(R.id.micro_blog_layout);

        weichat_tv = (TextView) findViewById(R.id.weichat_tv);
        phone_tv = (TextView) findViewById(R.id.phone_tv);
        micro_blog_tv = (TextView) findViewById(R.id.micro_blog_tv);
        phone_tv.setText(sharedPreferencesUtil.getData(mContext,SharedPreferencesUtil.USER_NAME,"")+"");
    }

    @Override
    public void onClick(View view) {
        if(view == modify_password_layout){
            Intent intent = new Intent(mContext,ModifypasswordActivity.class);
            startActivity(intent);
        }
    }
}
